import axios from '@/libs/api.request'
// 省列表
export const getProvinceList = (data) => {
  return axios.request({
    url: '/api/as/grid/register/getProvinceList',
    data: data,
    method: 'post'

  })
}
// 市列表
export const getCityList = (data) => {
  return axios.request({
    url: '/api/as/grid/register/getCityList',
    data: data,
    method: 'post'

  })
}
// 区列表
export const getAreaList = (data) => {
  return axios.request({
    url: '/api/as/grid/register/getAreaList',
    data: data,
    method: 'post'

  })
}
// 国家列表
export const getCountryList = (data) => {
  return axios.request({
    url: '/api/as/grid/register/getCountryList',
    data: data,
    method: 'post'

  })
}
// 查询个人信息
export const addUser = (data) => {
  return axios.request({
    url: '/api/ac/grid/gridLevelService/addUser',
    data: data,
    method: 'post'

  })
}
// 根据身份证号码获取年龄
export function getAgeByeCardNo (identityCard) {
  var len = (identityCard + '').length
  if (len === 0) {
    return 0
  } else {
    if ((len !== 15) && (len !== 18)) { // 身份证号码只能为15位或18位其它不合法
      return 0
    }
  }
  var strBirthday = ''
  if (len === 18) { // 处理18位的身份证号码从号码中得到生日和性别代码
    strBirthday = identityCard.substr(6, 4) + '/' + identityCard.substr(10, 2) + '/' + identityCard.substr(12, 2)
  } else if (len === 15) {
    strBirthday = '19' + identityCard.substr(6, 2) + '/' + identityCard.substr(8, 2) + '/' + identityCard.substr(10, 2)
  }
  var birthDate = new Date(strBirthday)
  var nowDateTime = new Date()
  var age = nowDateTime.getFullYear() - birthDate.getFullYear()
  if (nowDateTime.getMonth() < birthDate.getMonth() || (nowDateTime.getMonth() === birthDate.getMonth() && nowDateTime.getDate() < birthDate.getDate())) {
    age--
  }
  return age
}
// 根据身份证号码获取性别
export function getSexByeCardNo (idCard) {
  var sexStr = ''
  if (parseInt(idCard.slice(-2, -1)) % 2 === 1) {
    sexStr = '男'
  } else {
    sexStr = '女'
  }
  return sexStr
}
// 查询核酸轮次人员信息
export const findHspcList = (param) => {
  return axios.request({
    url: '/api/ac/bmt/gridHspcService/findHspcList',
    data: param,
    method: 'post'

  })
}
// 核酸人员处置
export const updateHandle = (data) => {
  return axios.request({
    url: '/api/ac/bmt/gridHspcService/updateHandle',
    data: data,
    method: 'post'

  })
}
// 核酸轮次字典
export const findLabelList = (data) => {
  return axios.request({
    url: '/api/ac/bmt/gridHspcService/findLabelList',
    data: data,
    method: 'post'

  })
}
// 核酸轮次统计
export const findTongList = (data) => {
  return axios.request({
    url: '/api/ac/bmt/gridHspcService/findTongList',
    data: data,
    method: 'post'

  })
}
// export const findZbTongList = (data) => { // 网格专班人员统计查询
//   return axios.request({
//     url: '/api/as/grid/gridSite/findTongList',
//     method: 'post',
//     data: data
//   })
// }
// 添加党员信息
export const createPartyMember = (data) => {
  return axios.request({
    url: '/api/ac/grid/partyMemberService/createPartyMember',
    data: data,
    method: 'post'
  })
}
// 更新党员信息
export const updatePartyMember = (data) => {
  return axios.request({
    url: '/api/ac/grid/partyMemberService/updatePartyMember',
    data: data,
    method: 'post'
  })
}
// 党员信息列表
export const getPartyMemberList = (data) => {
  return axios.request({
    url: '/api/ac/grid/partyMemberService/getPartyMemberList',
    data: data,
    method: 'post'
  })
}
export const getMzbSwList = (data) => {
  return axios.request({
    url: 'api/ac/grid/mzbSwService/getMzbSwList',
    method: 'post',
    data: data
  })
}
export const getSzwyListNotPage = (data) => { // 三长五员导出数据
  return axios.request({
    url: '/api/ac/grid/mzbSwService/getList',
    method: 'post',
    data: data
  })
}
